package com.dfbz.springboot_project.entity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Objects;

@Entity
public class Host {
    private String hostId;
    private String hostName;
    private String hostLocation;

    @Id
    @Column(name = "host_id", nullable = false, length = 15)
    public String getHostId() {
        return hostId;
    }

    public void setHostId(String hostId) {
        this.hostId = hostId;
    }

    @Basic
    @Column(name = "host_name", nullable = true, length = 20)
    public String getHostName() {
        return hostName;
    }

    public void setHostName(String hostName) {
        this.hostName = hostName;
    }

    @Basic
    @Column(name = "host_location", nullable = true, length = 30)
    public String getHostLocation() {
        return hostLocation;
    }

    public void setHostLocation(String hostLocation) {
        this.hostLocation = hostLocation;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Host host = (Host) o;
        return Objects.equals(hostId, host.hostId) &&
                Objects.equals(hostName, host.hostName) &&
                Objects.equals(hostLocation, host.hostLocation);
    }

    @Override
    public int hashCode() {
        return Objects.hash(hostId, hostName, hostLocation);
    }
}
